﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="LaiHanXXCX.aspx.cs" Theme="Default" Inherits="Web.Pages.YongShui._13.LAIHANGL.LaiHanXXCX" %>


<%@ Register Assembly="DevExpress.Web.v15.2, Version=15.2.9.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Web" TagPrefix="dx" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>来函信息</title>
    <script type="text/javascript" src="../../../JS/AddEditCancel.js"></script>
    <script type="text/javascript" src="../../../JS/jquery.js"></script>
    <style type="text/css">
        td { white-space: nowrap; }
    </style>
    <script type="text/javascript">
        function OnInit(s, e) {
            AdjustSize();
        }

        function OnEndCallback(s, e) {
            AdjustSize();
        }

        function AdjustSize() {
            var height = Math.max(0,
                document.documentElement.clientHeight - document.getElementById("top").height - 200);
            grid.SetHeight(height);

            loadColor();
        }
        function Search() {
            if (event.keyCode == 13) {
                if (txtShuiLiangNY.GetText() != "" && isNaN(txtShuiLiangNY.GetText())) {
                    alert("请输入正确的水量年月");
                    return;
                }
                BtnSearch.onClick();
            }
        }

        function ShowMag(values) {
            //alert(values[2]);
            if (values[2] == "1") {
                openCenter("YUEDuTZXX.aspx?yonghubh=" + values[1] + "&laihanbh=" + values[0], "960px", "650px");
            } else if (values[2] == "2") {
                openCenter("NianDuTZXXXX.aspx?id=" + values[3], "960px", "700px");
            } else if (values[2] == "3") {
                openCenter("JiHuaZYXXXX.aspx?id=" + values[3], "960px", "820px");
            }
        }

        function openWJLB(id) {
            openCenter("/Pages/YongShui/13.LAIHANGL/LaiHanDYWJLB.aspx?lhid=" + id, "700px", "380px");
        }

        function openWJLB2(id, yonghuh1, lhlx) {
            //alert(lhlx);
            var flag = HiddenView.Get("LHFlag");
            if (flag == 0) {
                openCenter("/Pages/YongShui/13.LAIHANGL/LAIHANWJLB.aspx?laihanbh=" +
                id +
                "&yonghuh=" +
                yonghuh1 +
                "&laihanlx=" + lhlx + "&laihanlc=70",
                "700px",
                "380px");
            }
            else {//20190327 add 添加特殊权限点可删除、上传文件功能
                openCenter("/Pages/YongShui/13.LAIHANGL/LAIHANWJLB.aspx?laihanbh=" + id +
                "&yonghuh=" + yonghuh1 +
                "&laihanlx=" + lhlx +
                "&lhflag=" + flag,
                "700px",
                "380px");
            }
        }

        function openXXXX(id, laihanlx) {
            var url = "";
            //if (laihanlx <= 20)
            //{
            //    return;
            //}
            if (laihanlx == 2) {
                url = "NianDuTZXXXX.aspx";
            } else if (laihanlx == 5) {
                url = "JiJianTZXXXX.aspx";
            } else if (laihanlx == 1) {
                url = "YUEDuTZXX.aspx";
            } else if (laihanlx == 3) {
                url = "JiHuaZYXXXX.aspx";
            } else if (laihanlx == 6) {
                url = "JiHuaBGXXXX.aspx";
            } else if (laihanlx == 8) {
                url = "FenHuXXXX.aspx";
            } else if (laihanlx == 9) {
                url = "BingHuXXXX.aspx";
            } else if (laihanlx == 11) {
                url = "XiaoHuXXXX.aspx";
            } else if (laihanlx == 12) {
                url = "XiaoBiaoXXXX.aspx";
            } else if (laihanlx == 7) {
                url = "TuiKuanXXXX.aspx";
            } else if (laihanlx == 10) {
                url = "GaiHuXXXX.aspx";
            } else if (laihanlx == 13) {
                url = "BiaoJiYSZXXXXX.aspx";
            } else if (laihanlx == 14) {
                url = "JiHuaZBZXXXXX.aspx";
            }
            else if (laihanlx == 21) {
                url = "/Pages/QuShui/13.LAIHANGL/BingHuXXXX.aspx";
            } else if (laihanlx == 22) {
                url = "/Pages/QuShui/13.LAIHANGL/XiaoHuXXXX.aspx";
            } else if (laihanlx == 23) {
                url = "/Pages/QuShui/13.LAIHANGL/XiaoJinXXXX.aspx";
            } else if (laihanlx == 24) {
                url = "/Pages/QuShui/13.LAIHANGL/XiaoBiaoXXXX.aspx";
            } else if (laihanlx == 25) {
                url = "/Pages/QuShui/13.LAIHANGL/XiaoJinHFXXXX.aspx";
            } else if (laihanlx == 26) {
                url = "/Pages/QuShui/13.LAIHANGL/JinGuoHXXXX.aspx";
            } else if (laihanlx == 27) {
                url = "/Pages/QuShui/13.LAIHANGL/BiaoGuoHXXXX.aspx";
            } else if (laihanlx == 28) {
                url = "/Pages/QuShui/13.LAIHANGL/FenHuXXXX.aspx";
            } else if (laihanlx == 29) {
                url = "/Pages/QuShui/13.LAIHANGL/ShenJinLXXGXXXX.aspx";
            } else if (laihanlx == 30) {
                url = "/Pages/QuShui/13.LAIHANGL/JinXingZXGXXXX.aspx";
            } else if (laihanlx == 31) {
                url = "/Pages/QuShui/13.LAIHANGL/TuiKuanXXXX.aspx";
            } else if (laihanlx == 32) {
                url = "/Pages/QuShui/13.LAIHANGL/KaiCaiJHXXXX.aspx";
            } else if (laihanlx == 33) {
                url = "/Pages/QuShui/13.LAIHANGL/CaiGuanJHXXXX.aspx";
            } else if (laihanlx == 34) {
                url = "/Pages/QuShui/13.LAIHANGL/JiaJiaSLTZXXXX.aspx";
            } else if (laihanlx == 35) {
                url = "/Pages/QuShui/13.LAIHANGL/XiaoQuShuiKXXXX.aspx";
            } else if (laihanlx == 36) {
                url = "/Pages/QuShui/13.LAIHANGL/QuShuiKGHXXXX.aspx";
            }
            openCenterScroll(url + "?id=" + id, "960px", "760px");
        }
        //20190326 add 添加来函删除功能
        function delLaiHan(id, laihanrq) {
            HiddenView.Set("ID", id);//删除ID
            var flag = HiddenView.Get("LHFlag");//来函修改权限
            var now = new Date();
            var today = new Date(now.getFullYear() + "/" + (now.getMonth() + 1) + "/" + now.getDate());
            if (flag < 2 && new Date(laihanrq) < today) {
                alert("当前权限只能删除当天来函。");
                return;
            }
            if (confirm("确认删除吗？")) {
                ASPxCallback1.PerformCallback("del");
            }
            else {
                HiddenView.Set("ID", -1);
            }
        }

        function ASPxCallback1Complete(rs) {
            var arr = rs.split('|');
            var type = arr[0];
            var state = arr[1];//IsSuccess
            var msg = arr[3].split('-');
            //修改
            if (type == "del") {
                if (msg[0] == 'True') {
                    alert(msg[1]);
                }
                if (state == 'True') {
                    grid.PerformCallback();
                }
            }
        }
    </script>
</head>
<body>
<form id="form1" runat="server">

<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
<asp:UpdatePanel runat="server" ID="updatePanel1">
<ContentTemplate>
<div>
<div class="tabletitle1" align="center">
    来函信息查询
</div>
<fieldset style="border: 1px solid cornflowerblue;">
    <legend>
        <b>查询</b>
    </legend>
    <table style="" id="top" border="0">
        <tr>
            <td style="text-align: right; width: 65px;">
                站点：
            </td>
            <td>
                <dx:ASPxComboBox ID="cmZhanDian" Width="100%" OnSelectedIndexChanged="cmZhanDian_SelectedIndexChanged" AutoPostBack="true" runat="server" ValueType="System.String"></dx:ASPxComboBox>
            </td>
            <td style="text-align: right; width: 70px;">
                管理块：
            </td>
            <td>
                <dx:ASPxComboBox ID="cmGuanLiK" Width="100%" runat="server" ValueType="System.String"></dx:ASPxComboBox>
            </td>
            <td style="text-align: right; width: 75px;">
                来函类型：
            </td>
            <td>
                <dx:ASPxComboBox ID="cmLaiHanLX" Width="100%" runat="server" ValueType="System.String"></dx:ASPxComboBox>
            </td>
            <td style="text-align: right; width: 75px;">
                办理状态：
            </td>
            <td style="width: 100px">
                <dx:ASPxComboBox ID="cmLiuChengBH" Width="100%" runat="server" ValueType="System.String">
                    <Items>
                        <dx:ListEditItem Text="全部" Value="-1" Selected="true"/>
                        <dx:ListEditItem Text="预登记" Value="0"/>
                        <dx:ListEditItem Text="登记" Value="1"/>
                        <dx:ListEditItem Text="受理" Value="20"/>
                        <dx:ListEditItem Text="不受理" Value="-20"/>
                        <dx:ListEditItem Text="承办人" Value="30"/>
                        <dx:ListEditItem Text="主任" Value="40"/>
                        <dx:ListEditItem Text="节水科" Value="50"/>
                        <dx:ListEditItem Text="计财科" Value="60"/>
                        <dx:ListEditItem Text="处长" Value="70"/>
                        <dx:ListEditItem Text="办结" Value="99"/>
                    </Items>
                </dx:ASPxComboBox>
            </td>
            <td style="text-align: right; width: 75px;">
                审批结果：
            </td>
            <td>
                <table>
                    <tr>
                        <td>
                            <dx:ASPxComboBox ID="cmShenPiJG" Width="100px" runat="server" ValueType="System.String">
                                <Items>
                                    <dx:ListEditItem Text="全部" Value="-1" Selected="true"/>
                                    <dx:ListEditItem Text="同意" Value="1"/>
                                    <dx:ListEditItem Text="不同意" Value="-3"/>
                                    <dx:ListEditItem Text="处理中" Value="0"/>                                    
                                    <dx:ListEditItem Text="不受理" Value="-20"/>                                    
                                </Items>
                            </dx:ASPxComboBox>
                        </td>
                        <td>
                            &nbsp;<dx:ASPxButton ID="BtnSearch" ClientInstanceName="BtnSearch" runat="server" OnClick="BtnSearch_Click" Text="查询">
                                <ClientSideEvents Click="function(s,e){LoadPanel.Show();}"/>
                            </dx:ASPxButton>
                        </td>
                        <td>
                            &nbsp;<dx:ASPxButton ID="BtnToExcel" ClientInstanceName="BtnToExcel" runat="server" Text="导出Excel">
                                    <ClientSideEvents  Click="function(s,e){btnExport.OnClick();}"/>
                            </dx:ASPxButton>
                        </td>
                    </tr>
                </table>
            </td>
            <td></td>
            <%--  <td align="center">

                                  
                                </td>--%>
            <%--<td></td>
                                <td></td>--%>
        </tr>
        <tr>
            <td style="text-align: right">
                用户号：
            </td>
            <td>
                <dx:ASPxTextBox ID="txtYongHuH" runat="server" Width="100%">
                    <ClientSideEvents KeyPress="function(s,e){Search();}"/>
                </dx:ASPxTextBox>
            </td>
            <td style="text-align: right">
                登记文号：
            </td>
            <td>
                <dx:ASPxTextBox ID="txtLaiHanBH" runat="server" Width="100%">
                    <ClientSideEvents KeyPress="function(s,e){Search();}"/>
                </dx:ASPxTextBox>
            </td>
            <td style="text-align: right">
                年月：
            </td>

            <td>
                <%--<dx:ASPxComboBox ID="cmShuiLiangNY" Width="100%" runat="server" ValueType="System.String"></dx:ASPxComboBox>--%>
                <dx:ASPxTextBox ID="txtShuiLiangNY" ClientInstanceName="txtShuiLiangNY" runat="server" Width="100%">
                    <ClientSideEvents KeyPress="function(s,e){Search();}"/>
                </dx:ASPxTextBox>
            </td>
            <td style="text-align: right; width: 100px" runat="server" id="tdTYSPBM1">统一审批编码：</td>
            <td runat="server" id="tdTYSPBM2">
                <dx:ASPxTextBox ID="txtShenPiBM" runat="server" Width="100%">
                    <ClientSideEvents KeyPress="function(s,e){Search();}"/>
                </dx:ASPxTextBox>
            </td>
            <td style="text-align: right">登记日期：</td>
            <td colspan="2">
                <table>
                    <tr>
                        <td>
                            <dx:ASPxComboBox runat="server" ID="cmbSY1" Width="60px">
                                <Items>
                                </Items>
                            </dx:ASPxComboBox>
                        </td>
                        <td>
                            <dx:ASPxComboBox runat="server" ID="cmbSM1" Width="60px">
                                <Items>
                                </Items>
                            </dx:ASPxComboBox>
                        </td>
                        <%--<td>
                                                    <dx:ASPxComboBox runat="server" ID="cmbSY2" Width="60px">
                                                        <Items>
                                                        </Items>
                                                    </dx:ASPxComboBox>
                                            </td>
                                            <td>
                                                    <dx:ASPxComboBox runat="server" ID="cmbSM2" Width="60px">
                                                        <Items>
                                                        </Items>
                                                    </dx:ASPxComboBox>
                                            </td>--%>
                    </tr>
                </table>
                <%-- <table>
                                        <tr>
                                            <td>
                                                <dx:ASPxDateEdit ID="txtDengJiRQ1" runat="server" Width="100px" EditFormatString="yyyyMMdd" DisplayFormatString="yyyyMMdd"  >
                                        <CalendarProperties  ClearButtonText="清除" TodayButtonText="今天" ></CalendarProperties>
                                                </dx:ASPxDateEdit>
                                            </td>
                                            <td>-</td>
                                            <td>
                                                <dx:ASPxDateEdit ID="txtDengJiRQ2" runat="server" Width="100px">                                                    
                                        <CalendarProperties  ClearButtonText="清除" TodayButtonText="今天" ></CalendarProperties>
                                                </dx:ASPxDateEdit>
                                            </td>
                                        </tr>
                                    </table>--%>

            </td>
        </tr>
    </table>
    <dx:ASPxLoadingPanel ID="LoadPanel" Theme="Metropolis" ClientInstanceName="LoadPanel" runat="server" Modal="True" Text="正在查询..."></dx:ASPxLoadingPanel>
    <dx:ASPxHiddenField ID="HiddenView" runat="server"></dx:ASPxHiddenField>
    <dx:ASPxCallback ID="ASPxCallback1" ClientInstanceName="ASPxCallback1" runat="server" OnCallback="ASPxCallback1_Callback" ClientSideEvents-CallbackComplete="function(s,e){ASPxCallback1Complete(e.result);}"></dx:ASPxCallback>
</fieldset>
<br/>
<fieldset style="border: 1px solid cornflowerblue;">
    <legend>
        <b>来函信息</b>
    </legend>
    <dx:ASPxGridView ID="gvList" ClientInstanceName="grid" runat="server" AutoGenerateColumns="False" KeyFieldName="ID" 
        Width="100%" Theme="Aqua1" OnCustomCallback="grid_CustomCallback">
        <Columns>
            <dx:GridViewDataTextColumn Caption="审批详情" Width="70px" CellStyle-HorizontalAlign="Center" HeaderStyle-HorizontalAlign="Center">
                <DataItemTemplate>
                    <a href='javascript:openXXXX(<%#Eval("ID") %>,<%#Eval("I_LAIHANLX") %>)'>查看</a>
                </DataItemTemplate>
                <HeaderStyle HorizontalAlign="Center" />
                <CellStyle HorizontalAlign="Center">
                </CellStyle>
            </dx:GridViewDataTextColumn>
            <dx:GridViewDataTextColumn FieldName="ID" Caption="主键" Visible="false" Width="100px" HeaderStyle-HorizontalAlign="Center">
                <HeaderStyle HorizontalAlign="Center" />
            </dx:GridViewDataTextColumn>
            <dx:GridViewDataTextColumn FieldName="S_LAIHANBH" Caption="登记文号" Width="100px" HeaderStyle-HorizontalAlign="Center">
                <HeaderStyle HorizontalAlign="Center" />
            </dx:GridViewDataTextColumn>
            <dx:GridViewDataTextColumn FieldName="S_XUKEBH" Caption="许可受理号" Width="110px" HeaderStyle-HorizontalAlign="Center">
                <HeaderStyle HorizontalAlign="Center" />
            </dx:GridViewDataTextColumn>
            <dx:GridViewDataTextColumn FieldName="S_TONGYIBM" Caption="统一审批编码" Width="110px" HeaderStyle-HorizontalAlign="Center">
                <HeaderStyle HorizontalAlign="Center" />
            </dx:GridViewDataTextColumn>
            <dx:GridViewDataTextColumn FieldName="S_LAIHANLXMC" Caption="函件类型" Width="80px" HeaderStyle-HorizontalAlign="Center">
                <HeaderStyle HorizontalAlign="Center" />
            </dx:GridViewDataTextColumn>


            <dx:GridViewDataTextColumn FieldName="S_YONGHUBH" Caption="用户号" Width="80px" HeaderStyle-HorizontalAlign="Center">
                <HeaderStyle HorizontalAlign="Center" />
            </dx:GridViewDataTextColumn>
            <dx:GridViewDataTextColumn FieldName="S_YONGHUM" Caption="用户名" Width="300px" HeaderStyle-HorizontalAlign="Center">
                <HeaderStyle HorizontalAlign="Center" />
            </dx:GridViewDataTextColumn>

            <dx:GridViewDataTextColumn FieldName="S_YM" Caption="水量年月" Width="60px" HeaderStyle-HorizontalAlign="Center">
                <HeaderStyle HorizontalAlign="Center" />
            </dx:GridViewDataTextColumn>
            <dx:GridViewDataTextColumn FieldName="S_YWY" Caption="承办人" Width="60px" HeaderStyle-HorizontalAlign="Center">
                <HeaderStyle HorizontalAlign="Center" />
            </dx:GridViewDataTextColumn>

            <dx:GridViewDataTextColumn FieldName="D_LAIHANRQ" PropertiesTextEdit-DisplayFormatString="{0:yyyy-MM-dd}" Width="80px" Caption="来函日期" HeaderStyle-HorizontalAlign="Center">
                <PropertiesTextEdit DisplayFormatString="{0:yyyy-MM-dd}">
                </PropertiesTextEdit>
                <HeaderStyle HorizontalAlign="Center" />
            </dx:GridViewDataTextColumn>
            <dx:GridViewDataTextColumn FieldName="D_SHURURQ" PropertiesTextEdit-DisplayFormatString="{0:yyyy-MM-dd}" Width="80px" Caption="登记日期" HeaderStyle-HorizontalAlign="Center">
                <PropertiesTextEdit DisplayFormatString="{0:yyyy-MM-dd}">
                </PropertiesTextEdit>
                <HeaderStyle HorizontalAlign="Center" />
            </dx:GridViewDataTextColumn>
            <dx:GridViewDataTextColumn FieldName="S_DJR" Width="80px" Caption="登记人" HeaderStyle-HorizontalAlign="Center">
                <HeaderStyle HorizontalAlign="Center" />
            </dx:GridViewDataTextColumn>
            <dx:GridViewDataTextColumn FieldName="D_SHENPIRQ" Caption="审批日期" PropertiesTextEdit-DisplayFormatString="{0:yyyy-MM-dd}" Width="80px" HeaderStyle-HorizontalAlign="Center">
                <PropertiesTextEdit DisplayFormatString="{0:yyyy-MM-dd}">
                </PropertiesTextEdit>
                <HeaderStyle HorizontalAlign="Center" />
            </dx:GridViewDataTextColumn>
            <dx:GridViewDataTextColumn FieldName="SPJG" Caption="审批结果" HeaderStyle-HorizontalAlign="Center">
                <HeaderStyle HorizontalAlign="Center" />
            </dx:GridViewDataTextColumn>

            <dx:GridViewDataTextColumn FieldName="S_LIUCHENGZT" Caption="办理状态" HeaderStyle-HorizontalAlign="Center">
                <HeaderStyle HorizontalAlign="Center" />
            </dx:GridViewDataTextColumn>
            <dx:GridViewDataTextColumn Caption="来函资料" Width="60px" CellStyle-HorizontalAlign="Center" HeaderStyle-HorizontalAlign="Center">
                <DataItemTemplate>
                    <a href='javascript:openWJLB2(<%#Eval("S_LAIHANBH") %>,"<%#Eval("S_YONGHUBH") %>","<%#Eval("I_LAIHANLX") %>")'>查看</a>
                </DataItemTemplate>
                <HeaderStyle HorizontalAlign="Center" />
                <CellStyle HorizontalAlign="Center">
                </CellStyle>
            </dx:GridViewDataTextColumn>
            <dx:GridViewDataTextColumn Width="50px" CellStyle-HorizontalAlign="Center" HeaderStyle-HorizontalAlign="Center">
              
                <HeaderStyle HorizontalAlign="Center" />
                <CellStyle HorizontalAlign="Center">
                </CellStyle>
            </dx:GridViewDataTextColumn>
            <dx:GridViewDataTextColumn Caption=" " Width="50px" CellStyle-HorizontalAlign="Center" HeaderStyle-HorizontalAlign="Center">
                <HeaderStyle HorizontalAlign="Center" />
                <CellStyle HorizontalAlign="Center">
                </CellStyle>
            </dx:GridViewDataTextColumn>
        </Columns>
        <SettingsPager PageSize="50" Mode="ShowAllRecords"></SettingsPager>
        <Settings VerticalScrollableHeight="350" VerticalScrollBarMode="Auto" HorizontalScrollBarMode="Auto"/>
        <ClientSideEvents Init="OnInit" EndCallback="OnEndCallback"/>
        <SettingsBehavior AllowFocusedRow="True" ColumnResizeMode="Control" />
    </dx:ASPxGridView>
    <br/>
    <table style="width: 100%">
        <tr>
            <td runat="server" id="PageCount"></td>
        </tr>
    </table>
</fieldset>
</div>
</ContentTemplate>
</asp:UpdatePanel>
<dx:ASPxGridViewExporter ID="ASPxGridViewExporter1" runat="server" FileName="来函信息" GridViewID="gvList"></dx:ASPxGridViewExporter>
<div style="display:none;">
    <dx:ASPxButton ID="btnExport" runat="server" ClientInstanceName="btnExport" Text="导出EXCEL" OnClick="BtnToExcel_Click" UseSubmitBehavior="false">
    </dx:ASPxButton>
</div> 
</form>
</body>
    <script>
        //$('#BtnSearch_CD').click(function () {
            
        //    setTimeout('loadColor()', 600);
        //})
        function loadNumber() {

            //statusLen = 0;
            remberLength = 0;
        }
        //gvList
        //计算两日期相差天数
        function datedifference(sDate1, sDate2) {    //sDate1和sDate2是 yyyy-mm-dd格式  
            var dateSpan,
                tempDate,
                iDays;
            sDate1 = Date.parse(sDate1);
            sDate2 = Date.parse(sDate2);
            dateSpan = sDate2 - sDate1;
            //  dateSpan = Math.abs(dateSpan);
            iDays = Math.floor(dateSpan / (24 * 3600 * 1000));
            return iDays
        };

        //获取下一天日期
        function getNextDay(d) {
            d = new Date(d);
            d = +d + 1000 * 60 * 60 * 24;
            d = new Date(d);
            //return d;
            //格式化
            return d.getFullYear() + "-" + (d.getMonth() + 1) + "-" + d.getDate();

        }
        //返回日期是否为工作日
        function returnIsWork(year, month, day) {
            var type;
            $.ajax({
                type: "post",
                cache: false,
                async: false,
                url: "/ashx/LH/LaiHan.ashx",
                data: {
                    "op": "ISWork",
                    year: year,
                    month: month,
                    day: day
                },
                dataType: "json",
                success: function (rs) {
                    type = rs;
                }
            });
            return type;
        }

        var statusLen=0;
        var remberLength=0 ;
        var word = $(".dxgv div").html();
        word = word.replace(/\s/g, "");
        //判断来函存在期效
        function loadColor() {
            
            if (statusLen == 0)
            {
                var allLength = $("#gvList_DXMainTable").find("tbody tr").length;
                if (word == "没有数据") allLength=0;
                remberLength = 0;
                statusLen = 1;
            }
            else
            {
                var allLength = $("#gvList_DXMainTable").find("tbody tr").length;
            }
            alert("remberLength" + remberLength);
            alert("allLength" + allLength);
            for (var j = remberLength; j < allLength; j++)
            {
                //alert("j:" + j + "  当前remberLength：" + remberLength + "  当前allLength" + allLength);
                var djwh = $("#gvList_DXDataRow" + j + " td:eq(1)").text(); //来函类型
                var lhlx = $("#gvList_DXDataRow" + j + " td:eq(4)").text(); //来函类型
                var date = $("#gvList_DXDataRow" + j + " td:eq(10)").text(); //登记日期
                var status = $("#gvList_DXDataRow" + j + " td:eq(13)").text(); //状态
                //alert("djwh:"+djwh+"   lhlx:" + lhlx + "  date:" + date + "  status:" + status);
                date = date.split('-');
                date = new Date(date);
                var year = date.getFullYear();
                var month = date.getMonth() + 1;
                var day = date.getDate();
                if (lhlx == '月计划调整' || lhlx == '年计划调整' || lhlx == '计划变更' || lhlx == '计划转移' || lhlx == '临时用水(原基建)') {
                    //if (status != '流程中')
                    //    return;
                    var countDay = 0;
                    var newDate;//最后受理期限
                    for (var i = 0; i <= 10; i++) //此处循环循环后5天的天数有工作日 countDay+1
                    {
                        if (i == 0) {
                            newDate = date;
                            var newYear = newDate.getFullYear();
                            var newMonth = newDate.getMonth() + 1;
                            var newDay = newDate.getDate();
                            var type = returnIsWork(newYear, newMonth, newDay); //返回e ：1工作日 0 非工作日 -1数据库不存在此时间当工作日处理
                            if (type == "0") {
                                countDay++;
                            }
                        } else {
                            newDate = newDate.split('-');
                            newDate = new Date(newDate);
                            var newYear = newDate.getFullYear();
                            var newMonth = newDate.getMonth() + 1;
                            var newDay = newDate.getDate();
                            var type = returnIsWork(newYear, newMonth, newDay); //返回e ：1工作日 0 非工作日 -1数据库不存在此时间当工作日处理
                            if (type == "0") {
                                countDay++;
                            }
                        }
                        newDate = getNextDay(newDate);  //日期+1
                    }
                    for (var i = 0; i < countDay; i++)  //循环 countDay 日期追加1，直到循环处工作日为止
                    {
                        newDate = new Date(newDate);
                        var newYear = newDate.getFullYear();
                        var newMonth = newDate.getMonth() + 1;
                        var newDay = newDate.getDate();
                        var type = returnIsWork(newYear, newMonth, newDay); //返回e ：1工作日 0 非工作日 -1数据库不存在此时间当工作日处理
                        if (type == "0") {
                            countDay++;
                            newDate = getNextDay(newDate);  //日期+1
                        }
                    }
                    var finalFDate = newDate;//最终时间
                    finalFDate = finalFDate.getFullYear() + "-" + (finalFDate.getMonth() + 1) + "-" + finalFDate.getDate();
                    //获取到系统时间与最终时间比较 得到相差天数
                    var sysDate = new Date();
                    sysDate = sysDate.getFullYear() + "-" + (sysDate.getMonth() + 1) + "-" + sysDate.getDate();
                    var diffDay = datedifference(finalFDate, sysDate);
                    //按相差天数设置颜色
                    if (diffDay >= -2 && diffDay <= 0) {
                        $("#gvList_DXDataRow" + j + "").css("color", " #FF8C00");
                    } if (diffDay > 0) {
                        $("#gvList_DXDataRow" + j + " ").css("color", "red");
                    } 
                    //alert("end");
                }
                remberLength++;
            }
            alert("目前记录行数："+remberLength);
            alert("目前最大行数："+allLength);
            return;


            $("#gvList_DXMainTable").find('tbody').each(function (index, item) {
                $(this).find('tr').each(function () {
                    var tdArr = $(this).children();
                    //td里的内容
                    var lhlx = tdArr.eq(4).text(); //来函类型
                    var date = tdArr.eq(10).text(); //登记日期
                    var status = tdArr.eq(13).text(); //状态
                    date = date.split('-');
                    date = new Date(date);
                    var year = date.getFullYear();
                    var month = date.getMonth() + 1;
                    var day = date.getDate();
                    if (lhlx == '月计划调整' || lhlx == '年计划调整' || lhlx == '计划变更' || lhlx == '计划转移' || lhlx == '临时用水(原基建)') {
                        if (status != '流程中')
                            return;
                        var countDay = 0;
                        var newDate;//最后受理期限
                        for (var i = 0; i <= 10; i++) //此处循环循环后5天的天数有工作日 countDay+1
                        {
                            if (i == 0) {
                                newDate = date;
                                var newYear = newDate.getFullYear();
                                var newMonth = newDate.getMonth() + 1;
                                var newDay = newDate.getDate();
                                var type = returnIsWork(newYear, newMonth, newDay); //返回e ：1工作日 0 非工作日 -1数据库不存在此时间当工作日处理
                                if (type == "0") {
                                    countDay++;
                                }
                            } else {
                                newDate = newDate.split('-');
                                newDate = new Date(newDate);
                                var newYear = newDate.getFullYear();
                                var newMonth = newDate.getMonth() + 1;
                                var newDay = newDate.getDate();
                                var type = returnIsWork(newYear, newMonth, newDay); //返回e ：1工作日 0 非工作日 -1数据库不存在此时间当工作日处理
                                if (type == "0") {
                                    countDay++;
                                }
                            }

                            newDate = getNextDay(newDate);  //日期+1
                        }
                        for (var i = 0; i < countDay; i++)  //循环 countDay 日期追加1，直到循环处工作日为止
                        {
                            newDate = new Date(newDate);

                            var newYear = newDate.getFullYear();
                            var newMonth = newDate.getMonth() + 1;
                            var newDay = newDate.getDate();
                            var type = returnIsWork(newYear, newMonth, newDay); //返回e ：1工作日 0 非工作日 -1数据库不存在此时间当工作日处理
                            if (type == "0") {
                                countDay++;
                                newDate = getNextDay(newDate);  //日期+1
                            }
                        }
                        var finalFDate = newDate;//最终时间
                        finalFDate = finalFDate.getFullYear() + "-" + (finalFDate.getMonth() + 1) + "-" + finalFDate.getDate();
                        //获取到系统时间与最终时间比较 得到相差天数
                        var sysDate = new Date();
                        sysDate = sysDate.getFullYear() + "-" + (sysDate.getMonth() + 1) + "-" + sysDate.getDate();
                        var diffDay = datedifference(finalFDate, sysDate);

                        //按相差天数设置颜色
                        if (diffDay >= -2 && diffDay <= 0) {
                            $(this).css("color", " 	#FF8C00");
                        } else if (diffDay > 0) {
                            $(this).css("color", "red");
                        } else {
                            $(this).css("color", "black");
                        }

                    }

                });
            });
        }
    </script>
</html>